package day1206zy.day1206zy123;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class demo3 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        Class<?> dog = Class.forName("day1206zy123.Dog");
        Constructor<?> c1 = dog.getConstructor();
        Object o = c1.newInstance();
        Method cell = dog.getMethod("cell");
        cell.invoke(o);
        Method sleep = dog.getMethod("sleep");
        sleep.invoke(o);
    }
}
